package com.chilly.vidio.study.leetcode;

import java.util.Arrays;

/**
 * 215. 数组中的第K个最大元素
 * <p>
 * 示例 1:
 * 输入: [3,2,1,5,6,4] 和 k = 2
 * 输出: 5
 * <p>
 * 示例 2:
 * 输入: [3,2,3,1,2,4,5,5,6] 和 k = 4
 * 输出: 4
 *
 * @author Chilly Cui
 * @createDate 2021/2/28
 */
public class No215KthLargestElementInAnArray {

    public static void main(String[] args) {
        int[] nums = {3, 2, 3, 1, 2, 4, 5, 5, 6};
        Arrays.sort(nums);
        System.out.println(Arrays.toString(nums));

    }

    static class Solution {
        public int findKthLargest(int[] nums, int k) {
            if (nums.length < k) {
                return -1;
            }

            return 0;
        }

        private void swap(int[] nums, int left, int right) {
            int temp = nums[left];
            nums[left] = nums[right];
            nums[right] = temp;
        }
    }
}